<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Max-Age: 1000');

require "../config.php";
require "../libs/db_functions.php";

$story_id =  isset($_GET['story_id'])? $_GET['story_id'] : 1;
$chapter_id =  isset($_GET['chapter_id'])? $_GET['chapter_id'] : 1;

  CONNECT_DB();
    mysql_query("SET NAMES utf8");
	$table_name = 'story_id_'.$story_id;
	$sql=" SELECT chapter_content FROM $table_name WHERE chapter_id = $chapter_id";
    $result=mysql_query($sql);
	$data = mysql_fetch_row($result);
	echo $data[0];   
?> 